/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ivanbiz.dao.impl;

import com.ivanbiz.dao.ItemDAO;
import com.ivanbiz.helper.HibernateUtil;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Session;

/**
 *
 * @author Administrator
 */
public class ItemDAOImpl extends GenericDAOImpl implements ItemDAO {

    
    public List searchByLimit(String limit) throws Exception {
        List list = new ArrayList();
        try {
            HibernateUtil.beginTransaction();
            Session session = HibernateUtil.getSession();
            list = (List) session.createQuery("from com.ivanbiz.model.Item i where i.stock <= '" + limit + "'").list();
            HibernateUtil.commitTransaction();
        } catch (Exception e) {
            HibernateUtil.rollbackTransaction();
            throw e;
        } finally {
            HibernateUtil.closeSession();
        }

        return list;
    }
}
